package id.mankel.commons.function;

import java.util.function.Consumer;

/**
 * Normal Consumer: <code>Consumer&lt;T&gt; c = t -> {};</code>
 * <p>
 * Normal Consumer: <code>(ThrowableConsumer&lt;T&gt;) t -> {};</code>
 * @see org.apache.commons.lang3.function.Failable
 */
@FunctionalInterface
public interface ThrowableConsumer<T> extends Consumer<T> {

    @Override
    default void accept(T t) {
        try {
            this.throwableAccept(t);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    void throwableAccept(T t) throws Exception;
}
